<?php
	$iii=array();
	$jjj=array();
	$kkk=array();
	$ppp=array();
	
	$lock_list = get_ad_lock_list('lock');
	$lock_list_size = count($lock_list);
$n=0;
foreach($lock_list as $data)
	{
		$iii[$n]="upfiles/".$data['images2'];
		$jjj[$n]=$data['linkisok'];
		$kkk[$n]=$data['link1'];
		$ppp[$n]=$data['link2'];
		$n=$n+1;
	}
	$sql="select * from ad where isok=0 and images2!=''   and `lock`=''   order by id desc";			
	$result=mysql_query($sql);
	while ($row=mysql_fetch_object($result)){
	$iii[$n]="upfiles/".$row->images2;
	$jjj[$n]=$row->linkisok;
	$kkk[$n]=$row->link1;
	$ppp[$n]=$row->link2;
	$n=$n+1;
	}
	
	if($lock_list_size < $n && $lock_list_size > 0)
	{
		$cards =range(0,$lock_list_size -1 );
		
	   $cards_o=range($lock_list_size,$n-1);
	   shuffle($cards_o);
	   foreach($cards_o as $indexN)
	   {
	   		$cards[] = $indexN;
	   }
	}else{
		$cards=range(0,$n-1);
		shuffle($cards);
	}
?>
<link href="css/slided.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.cycle.js"></script>
<script type="text/javascript" src="js/slideshow.js"></script>
<div id="ad-b">

<div id="slideshow" class="clearfix">

		<div class="slides clearfix">

			<ul class="clearfix">

<?php
for($i=0;$i<6 && $i < $n;$i++){
?>
<li id="main-post-<?php echo ($i+1);?>">
<div >
<?php    //1
if($jjj[$cards[$i]]==1){
?>
<img   src="<?php echo $iii[$cards[$i]];?>"/>
<?php }?>

<?php 
if($jjj[$cards[$i]]==2){
?>
<a href="<?php echo $kkk[$cards[$i]];?>" target="_blank">
<img   src="<?php echo $iii[$cards[$i]];?>"/>
</a>
<?php }?>


<?php 
if($jjj[$cards[$i]]==3){
?>
<a href="http://<?php echo $ppp[$cards[$i]];?>" target="_blank">
<img   src="<?php echo $iii[$cards[$i]];?>" />
</a>
<?php }?>
</div>
</li>
<?php }?>

</ul>
</div>		
<div>


	<ul class="slides-nav">
			<?php
				for($i=0;$i<6 && $i < $n;$i++){
			?>
			<?php if($i == 0):?>
			<li class="clearfix on" id="nav-post-<?php echo ($i+1);?>">
				<a href="#main-post-<?php echo ($i+1);?>" >	  </a>
	        </li>
	        <?php else:?>
	        <li class="clearfix" id="nav-post-<?php echo ($i+1);?>">
				<a href="#main-post-<?php echo ($i+1);?>" >	  </a>
	        </li>
	        <?php endif;?>
			<?php } ?>
</ul>					
		
		
</div>		
		
		

	</div>
</div>